<!--
 * @Description: 培训班总结表
 * @Autor: dyx
 * @Date: 2023-05-31 17:36:40
 * @LastEditTime: 2023-06-02 11:12:48
-->

<template>
  <div class="TISchedule">
    <div style="padding-right: 7px;">
      <el-button type="primary" style="float:right" @click="exportWord"
        >导出Word</el-button
      >
    </div>
    <div class="mytable" v-loading="loading">
      <div class="table_title">培训班总结表</div>
      <table>
        <tr>
          <td colspan="2" width="20%">
            培训班名称
          </td>
          <td colspan="5">
            <input
              type="text"
              style="width:100%"
              v-model="dataForm.className"
            />
          </td>
        </tr>

        <tr>
          <td colspan="2" width="20%">
            参培人数
          </td>
          <td width="10%">
            <input type="text" style="width:100%" v-model="dataForm.cprs" />
          </td>
          <td colspan="2" width="15%">培训时间</td>
          <td colspan="2" width="18%" style="text-align:left">
            <div class="bomlabel_datetime">
              <span
                ><input
                  type="text"
                  style="width:13%"
                  v-model="dataForm.y"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                />年</span
              >
              <span
                ><input
                  type="text"
                  style="width:7%"
                  v-model="dataForm.m1"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                />月</span
              >
              <span
                ><input
                  type="text"
                  style="width:7%"
                  v-model="dataForm.d1"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                />日</span
              >
              <span> - </span>
              <span
                ><input
                  type="text"
                  style="width:7%"
                  v-model="dataForm.m2"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                />月</span
              >
              <span
                ><input
                  type="text"
                  style="width:7%"
                  v-model="dataForm.d2"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                />日</span
              >
            </div>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            培训地点
          </td>
          <td colspan="3">
            <input type="text" style="width:100%" v-model="dataForm.pxdd" />
          </td>
          <td>班主任</td>
          <td>
            <input type="text" style="width:100%" v-model="dataForm.bzr" />
          </td>
        </tr>
        <tr>
          <td colspan="2">
            学员出勤率
          </td>
          <td>
            <input type="text" style="width:80%" v-model="dataForm.cq" />%
          </td>
          <td>考试合格率</td>
          <td>
            <input type="text" style="width:80%" v-model="dataForm.hg" />%
          </td>
          <td>学员满意率</td>
          <td>
            <input type="text" style="width:80%" v-model="dataForm.my" />%
          </td>
        </tr>
        <tr>
          <td colspan="2">
            专职教师授课比例 (学时比)
          </td>
          <td colspan="2">
            <input type="text" style="width:80%" v-model="dataForm.zz" />%
          </td>
          <td colspan="2">兼职教师授课比例 (学时比)</td>
          <td>
            <input type="text" style="width:80%" v-model="dataForm.jz" />%
          </td>
        </tr>
        <tr>
          <td rowspan="6">
            基本情况和总体印象
          </td>
          <td>培训内容</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.pxnr" />
          </td>
        </tr>
        <tr>
          <td>授课教师</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.skjs" />
          </td>
        </tr>
        <tr>
          <td>教学资源</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.jxzy" />
          </td>
        </tr>
        <tr>
          <td>学员管理</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.xygl" />
          </td>
        </tr>
        <tr>
          <td>服务保障</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.fwbz" />
          </td>
        </tr>
        <tr>
          <td>培训成效</td>
          <td colspan="5">
            <input type="text" style="width:100%" v-model="dataForm.pxcx" />
          </td>
        </tr>
        <tr height="180px">
          <td colspan="2">
            存在问题及今后改进措施
          </td>
          <td colspan="5">
            <textarea
              style="width:100%; height:180px"
              v-model="dataForm.czwt"
            ></textarea>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
import request from "@/utils/request";
export default {
  name: "TISchedule",
  data() {
    return {
      loading: true,
      dataForm: {},
      list: []
    };
  },
  created() {},
  methods: {
    init(id) {
      this.loading = true;
      request({
        url: "/api/class_archives/generateA8/" + id+`?organizeId=${this.$store.getters.organizeId}`,
        method: "get"
      }).then(res => {
        this.dataForm = res.data;
        this.loading = false;
      });
    },
    exportWord() {
      for (let key in this.dataForm) {
        if (this.dataForm[key] == null) {
          this.dataForm[key] = "";
        }
      }
      this.dataForm.organizeId=this.$store.getters.organizeId;
      request({
        responseType: "blob",
        url: "/api/class_archives/generateA8Export",
        method: "post",
        data: this.dataForm
      }).then(res => {
        var debug = res;
        if (debug) {
          var a = document.createElement("a");
          a.download = "培训班总结表.docx";
          a.style.display = "none";
          var blob = new Blob([debug], { type: "application/x-msdownload" });
          a.href = URL.createObjectURL(blob);
          document.body.appendChild(a);
          a.click();
          document.body.removeChild(a);
        }
      });
    }
  }
};
</script>
<style scoped lang="scss">
// 引入公共样式
@import "./TABLESTYLE.scss";

.bomlabel_datetime {
  span {
    margin: 0;
  }
}
</style>
